home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
breakable.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
3KB
|
600 lines
int Initialize(string type)
{
global string gMessage;
global real gInRadius = 60.0;
global real gOutRadius = 90.0;
global int gNetwork = 0;
global int hitValue = 15;
global int gHasBrokenObject = 0;
global string gBrokenObject = "";
global int gEndSound = 27;
global int gStartSound = -1;
global real gMass = 5.0;
global int gMsgSnd = -1;
global int gState;
global int gAnimate = 0;
Reset("dummy");
return 0;
}
int Reset(string dummy)
{
wakeupTime = -1.0;
gState = 0;
SetStyle(thisObject,0);
SetCollidableProperties(thisObject,0,0);
wakeupTime = 0.1;
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int msgsnd(string soundname)
{
gMsgSnd = GetSoundIndex(soundname);
}
int brokenobject(string str)
{
gHasBrokenObject = 1;
gBrokenObject = str;
}
int inradius(string str)
{
gInRadius = Str2Real(str);
}
int network(string str)
{
gNetwork = Str2Int(str);
}
int outradius(string str)
{
gOutRadius = Str2Real(str);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int Explosion(int param)
{
real time ;
time = GetTime(thisObject);
SetStyle(thisObject,4);
PlaySound(thisObject,gEndSound);
LaunchEFX(thisObject,2,0);
SetCollidableProperties(thisObject,0,0);
wakeupTime = time + 0.1;
gState = 1;
return 0;
}
int Injure(string key, real x, real y, real z,real magnitude,real mass)
{
if (IsAuthoritative(thisObject) != 1)
return;
if (IsAlive(thisObject) != 1)
{
Explosion(0);
SendMessage(thisObject,gOutRadius,gNetwork);
SendEnglishMessage(thisObject);
PlaySound(thisObject, gMsgSnd);
}
return 0;
}
int TimedEvent(int input)
{
if (gState == 0)
{
if (gAnimate == 1)
{
OpenLowLevel ();
wakeupTime = -1.0;
}
}
else if (gState == 1)
{
if (gHasBrokenObject == 1)
CreateObject( gBrokenObject,"" );
Remove(thisObject);
wakeupTime = -1.0;
}
return 0;
}
int start(string dummy)
{
gAnimate = 1;
}
int OpenLowLevel ()
{
Animate(thisObject,1,"open");
AnimSetPhase(thisObject,0.0);
AnimSetDirection(thisObject,0);
PlaySound(thisObject,gStartSound);
return 0;
}
int CloseLowLevel ()
{
Animate(thisObject,1,"open");
AnimSetPhase(thisObject,1.0);
AnimSetDirection(thisObject,1);
PlaySound(thisObject,gEndSound);
return 0;
}